<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>oscP5 : : OscP5</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>OscP5</h1>
		<dl><dt class="key">description</dt><dd class="value">oscP5 is an osc implementation for the programming environment processing.
 osc is the acronym for open sound control, a network protocol developed at
 cnmat, uc berkeley. open sound control is a protocol for communication among
 computers, sound synthesizers, and other multimedia devices that is optimized
 for modern networking technology and has been used in many application areas.
 for further specifications and application implementations please visit the
 official osc site.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>/**
 * oscP5sendreceive by andreas schlegel
 * example shows how to send and receive osc messages.
 * oscP5 website at http://www.sojamo.de/oscP5
 */
 
import oscP5.*;
import netP5.*;
  
OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400,400);
  frameRate(25);
  /* start oscP5, listening for incoming messages at port 12000 */
  oscP5 = new OscP5(this,12000);
  
  /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
   * an ip address and a port number. myRemoteLocation is used as parameter in
   * oscP5.send() when sending osc packets to another computer, device, 
   * application. usage see below. for testing purposes the listening port
   * and the port of the remote location address are the same, hence you will
   * send messages back to this sketch.
   */
  myRemoteLocation = new NetAddress("127.0.0.1",12000);
}


void draw() {
  background(0);  
}

void mousePressed() {
  /* in the following different ways of creating osc messages are shown by example */
  OscMessage myMessage = new OscMessage("/test");
  
  myMessage.add(123); /* add an int to the osc message */

  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
}


/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
  /* print the address pattern and the typetag of the received OscMessage */
  print("### received an osc message.");
  print(" addrpattern: "+theOscMessage.addrPattern());
  println(" typetag: "+theOscMessage.typetag());
}
</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>OscP5(theParent, theProperties);
OscP5(theParent, theAddress, thePort, theMode);
OscP5(theParent, theReceiveAtPort, theMode);
OscP5(theParent, theReceiveAtPort);
OscP5(theParent, theAddress, thePort);
</pre></dd></dl>
			
			
			
			
   <dl><dt class="key">parameters</dt><dd class="value"><span class="parameters">theParent</span><span class="parameters">Object</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theProperties</span><span class="parameters">OscProperties</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theAddress</span><span class="parameters">String</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">thePort</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theMode</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theReceiveAtPort</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
</dl>
			
			
			
       <dl class="noborder"><dt>Fields</dt></dl>
       <dl><dt class="key"><a href="oscp5_field_multicast.htm">MULTICAST</a></dt><dd class="value">a static variable used when creating an oscP5 instance with a sepcified network protocol.</dd></dl>
<dl><dt class="key"><a href="oscp5_field_tcp.htm">TCP</a></dt><dd class="value">a static variable used when creating an oscP5 instance with a sepcified network protocol.</dd></dl>
<dl><dt class="key"><a href="oscp5_field_udp.htm">UDP</a></dt><dd class="value">a static variable used when creating an oscP5 instance with a sepcified network protocol.</dd></dl>

   
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="oscp5_method_flush.htm">flush ( )</a></dt><dd class="value">a static method to send an OscMessage straight out of the box without
 having to instantiate oscP5.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_netinfo.htm">netInfo ( )</a></dt><dd class="value">netinfo() returns an instance of a NetInfo Object from which you can get
 LAN and WAN information.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_plug.htm">plug ( )</a></dt><dd class="value">osc messages can be automatically forwarded to a specific method of an
 object. the plug method can be used to by-pass parsing raw osc messages -
 this job is done for you with the plug mechanism. you can also use the
 following array-types int[], float[], String[]. (but only as on single
 parameter e.g. somemethod(int[] theArray) {} ).</dd></dl>
<dl><dt class="key"><a href="oscp5_method_properties.htm">properties ( )</a></dt><dd class="value">returns the current properties of oscP5.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_send.htm">send ( )</a></dt><dd class="value">the send method offers a lot of possibilities. have a look in the send
 documentation.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_setlogstatus.htm">setLogStatus ( )</a></dt><dd class="value">oscP5 has a logging mechanism which prints out processes, warnings and
 errors into the console window. e.g. turn off the error log with
 setLogStatus(Logger.ERROR, Logger.OFF);</dd></dl>
<dl><dt class="key"><a href="oscp5_method_settimetolive.htm">setTimeToLive ( )</a></dt><dd class="value">set timeToLive of a multicast packet.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_stop.htm">stop ( )</a></dt><dd class="value">stop oscP5 and close open Sockets.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_tcpclient.htm">tcpClient ( )</a></dt><dd class="value">return the instance of the running TCP client if in TCP mode.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_tcpserver.htm">tcpServer ( )</a></dt><dd class="value">return the instance of the running TCP server if in TCP mode.</dd></dl>
<dl><dt class="key"><a href="oscp5_method_version.htm">version ( )</a></dt><dd class="value">get the current version of oscP5.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul><li><a href="oscproperties_class_oscproperties.htm">OscProperties</a></li>
<li><a href="oscmessage_class_oscmessage.htm">OscMessage</a></li>
<li><a href="oscbundle_class_oscbundle.htm">OscBundle</a></li>
</ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


